#pragma once
#include <TLHELP32.H>
//#include <WtsApi32.h>
//#include <psapi.h>

//#pragma comment (lib, "psapi.lib")
//#pragma comment (lib, "WtsApi32.lib")

typedef struct
{
	TCHAR szProcess[512][MAX_PATH];
	DWORD dwPID;
}FunParam, *LPFunParam;

typedef struct _RemoteParam
{
	char szFuntion[MAX_PATH];
	FunParam FuntionParam;
	TCHAR szDllPath[MAX_PATH];
	FARPROC m_procLoadLibraryAddr;
	FARPROC m_procFreeLibraryAddr;
	FARPROC m_procGetProcAddrAddr;

} RemoteParam, *PRemoteParam;


extern "C" class _declspec(dllexport) CHooker
{
public:
	CHooker(void);
	~CHooker(void);
	BOOL UpgradeProcessPrivilege();
	BOOL SetMsgHook(LPTSTR lpszImageName, LPTSTR lpszDLL);
	BOOL UnHookMsgHook(HHOOK hHook);
	BOOL InjectDLLHook(LPTSTR lpszImageName, LPTSTR lpszDLL);
	BOOL OutjectDLLHook(LPTSTR lpszImageName, LPTSTR lpszDLL);
	BOOL RunRemoteThread(LPTSTR lpszImageName, LPTSTR lpszDLL, LPTSTR lpszFuntion, LPVOID lParam);
protected:
	BOOL TranslateParameter(PRemoteParam lpstParam, LPVOID lParam);
private:
	DWORD GetThreadID(LPTSTR lpszImageName);
	DWORD GetProcessID(LPTSTR lpszImageName);
	HMODULE GetDllModule(DWORD dwProcessID, LPTSTR lpszDLL);
	BOOL GetDllPath(LPTSTR lpszDll, LPTSTR lpszPath);
	
	//BOOL UnloadDll(DWORD dwPid, TCHAR *strDllName);
	DWORD m_dwProcessID[512];
	int nCount;
	HHOOK m_hHook;
};
